﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SDT.Site.ViewModels.ProductSearchModels>" %>
<%@ Import Namespace="SDT.Model" %>
<%@ Import Namespace="SDT.Site.ViewModels" %>
<div class="t_red"><strong>Chuyên mục</strong></div>
<div id="list_choice">
    <ul>
        <% if (Model.Categories != null && Model.Categories.Count() > 0)
           {
               int count = 0;
               foreach (var c in Model.Categories)
               {
                   var path = string.Format("/product/index/{0}/{1}/{2}/{3}/{4}/{5}",
                   Model.TypeID.HasValue ? Model.TypeID.Value : 0,
                   Model.PriceID.HasValue ? Model.PriceID.Value : 0,
                   c.ID,
                   Model.HolidayID.HasValue ? Model.HolidayID.Value : 0,
                   Model.EventID.HasValue ? Model.EventID.Value : 0,
                   Model.SellID.HasValue ? Model.SellID.Value : 0);
                   path = SDT.Lib.Helpers.TextHelper.ToUrlShort(path);
                   var css = c.ID == Model.CategoryID ? "act" : string.Empty;
                   if (Model.Keyword != null && Model.Keyword != string.Empty) path = path + "?key=" + Model.Keyword;
                   count++;
                   var cssli = count > 10 ? "subo hide" : string.Empty;
                %>
                <li class="<%=cssli %>"><%=Html.CheckBox("chkCategory", css != string.Empty ? true : false, new { onclick = "if(this.checked){location.href='" + path + "'}" })%><a href="<%=path %>" class="<%=css %>"><%= c.Name %></a></li>
               <%}
           }%>
           <li class="subo" id="show-all-o"><a title="tất cả" href="javascript:ShowOrgLink(1);"> Tất cả [ <font style="color:#f87310;float:none;">+</font> ]</a></li>
           <li class="subo hide" id="hide-all-o"><a title="thu gọn" href="javascript:ShowOrgLink(0);"> Thu gọn [ <font style="color:#f87310;float:none;">-</font> ]</a></li>
    </ul>
</div>
<script type="text/javascript">
    function ShowOrgLink(showid) {
        if (showid == 1) {
            $(".subo").removeClass("hide");
            $("#show-all-o").addClass("hide");
        } else {
            $(".subo").addClass("hide");
            $("#show-all-o").removeClass("hide");
        }
    } 
</script>